Skip to content

Fix stagehand.metrics #176

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

miguelg719
Copy link
Collaborator

@miguelg719 miguelg719 commented Aug 12, 2025

why

Stagehand metrics were not working on env:BROWSERBASE

what changed

Added support for getting metrics when using the api

test plan

stagehand/api.py Outdated
Fetch replay metrics from the API endpoint /sessions/:id/replay and parse them
into StagehandMetrics format.
"""
from .metrics import StagehandMetrics
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move import

stagehand/api.py Outdated

async def _get_replay_metrics(self):
"""
Fetch replay metrics from the API endpoint /sessions/:id/replay and parse them
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

@miguelg719
Copy link
Collaborator Author

*note:
we need to inverstigate the prompt size / token usage on litellm. when running metrics on with use_api:true we get a different value than use_api:false

@miguelg719 miguelg719 marked this pull request as ready for review August 12, 2025 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants